package com.sie.controller;

import com.sie.pojo.Users;
import com.sie.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Objects;

@Controller
public class UsersController {

    @Autowired
    private UsersService usersService;

    @ResponseBody
    @RequestMapping("/login")
    public Integer login(String username, String password){
//        System.out.println(username+"=="+password);
        Users user = usersService.findByNameAndPwd(username, password);
        if (Objects.nonNull(user)){
            return 1;
        }
        return 0;
    }
}
